package com.mfh.auto.create.mvvm.autocreatemvvm.file.hm

import com.intellij.psi.PsiDirectory
import com.mfh.auto.create.mvvm.autocreatemvvm.Config
import com.mfh.auto.create.mvvm.autocreatemvvm.file.BaseFileModel

/**
 * 鸿蒙页面
 */
object HMPageViewModelFileModel : BaseFileModel() {

    override fun buildFileName() = "${Config.name}ViewModel.ets"

    override fun buildContentString(directory: PsiDirectory): String {
        val name = Config.name
        return buildString {
            appendLine(
                "import { BaseViewModel } from \"library\";\n" +
                        "\n" +
                        "/**\n" +
                        " * @desc: ${Config.desc}\n" +
                        " */\n" +
                        "@ObservedV2\n" +
                        "export class ${name}ViewModel extends BaseViewModel {\n" +
                        "\n" +
                        "}"
            )
        }
    }
}